# coding: utf-8
import xadmin
from xadmin import views
from xadmin.plugins.auth import UserAdmin

from .models import UserProfile, onceName, notice, noticeType

class BaseSetting(object):
    enable_themes = True
    use_bootswatch = True


class GlobalSettings(object):
    site_title = "秘密树洞后台管理系统"
    site_footer = "秘密树洞"
    menu_style = "TreeHole"


class UserProfileAdmin(UserAdmin):
    pass
    # list_display = ['id', 'username', 'phone', 'sex', 'age', 'years', 'birth']
    # search_fields = ['id', 'username', 'phone', 'sex', 'age', 'years', 'birth']
    # list_filter = ['id', 'username', 'phone', 'sex', 'age', 'years', 'birth']


class onceNameAdmin(object):
    list_display = ['user', 'name', 'time']
    search_fields = ['user', 'name', 'time']
    list_filter = ['user', 'name', 'time']


class noticeTypeAdmin(object):
    list_display = ['type', 'show', 'isDelete']
    search_fields = ['type', 'show', 'isDelete']
    list_filter = ['type', 'show', 'isDelete']


class noticeAdmin(object):
    list_display = ['noticeType' ,'user', 'secretModel', 'topicofcModel', 'noticeContent', 'replyModel', 'show', 'isDelete']
    search_fields = ['noticeType' ,'user', 'secretModel', 'topicofcModel','noticeContent', 'replyModel', 'show', 'isDelete']
    list_filter = ['noticeType' ,'user', 'secretModel', 'topicofcModel', 'noticeContent', 'replyModel', 'show', 'isDelete']


# xadmin.site.register(UserProfile, UserProfileAdmin)
xadmin.site.register(onceName, onceNameAdmin)
xadmin.site.register(noticeType, noticeTypeAdmin)
xadmin.site.register(notice, noticeAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)